package com.cndw.kungfu.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.cndw.kungfu.comm.AccessFlag;
import com.cndw.kungfu.comm.tencent.LogFieldType;
import com.cndw.kungfu.comm.tencent.QQDC;
import com.cndw.kungfu.config.Constants;
import com.cndw.kungfu.config.ConstantsCost;
import com.cndw.kungfu.config.ConstantsDailyItem;
import com.cndw.kungfu.config.ConstantsDayIntKey;
import com.cndw.kungfu.config.ConstantsFlag;
import com.cndw.kungfu.config.ConstantsFruit;
import com.cndw.kungfu.config.ConstantsIntKey;
import com.cndw.kungfu.config.ConstantsLevel;
import com.cndw.kungfu.config.ConstantsLog;
import com.cndw.kungfu.config.ConstantsModel;
import com.cndw.kungfu.domain.GoodsMode;
import com.cndw.kungfu.domain.Player;
import com.cndw.kungfu.ext.LangUtil;
import com.cndw.kungfu.ext.LanguageLib;
import com.cndw.kungfu.ext.LogUtil;
import com.cndw.kungfu.ext.NumberProcesser;
import com.cndw.kungfu.ext.TimeProcesser;
import com.cndw.kungfu.model.Context;
import com.cndw.kungfu.model.operation.domain.DragonAward;
import com.cndw.kungfu.model.operation.domain.PlayerFruit;
import com.cndw.kungfu.model.operation.domain.TreeFruit;
import com.cndw.kungfu.model.sys.ChatMain;
import com.cndw.kungfu.model.sys.LogServer;
import com.cndw.kungfu.vo.FruitVO;
import com.cndw.rpg.annotation.Controller;
import com.cndw.rpg.framework.ResponseMessage;
import com.cndw.rpg.framework.Session;

/**
 * 一些运营活动功能的入口
 * 
 * @author fantadust [9677889@qq.com]
 * @date 2012-6-29 上午10:48:29
 */
@AccessFlag(ConstantsFlag.fruit)
@Controller
public class OperationController {
	/**
	 * 树的显示
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage treeShow(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}

		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);
		Iterator<PlayerFruit> it = fruitMap.values().iterator();
		List<FruitVO> fruitsList = new ArrayList<FruitVO>();
		while (it.hasNext()) {
			PlayerFruit e = (PlayerFruit) it.next();
			if (e != null) {
				fruitsList.add(e.toVO());
			}
		}

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("fruits", fruitsList);
		map.put("fruitCD", ConstantsFruit.fruitCD);
		map.put("fruitFastGold", ConstantsFruit.fruitFastGold);
		map.put("fruitDayNum", player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.fruit));
		map.put("fruitDayMax", player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.fruitBuy) + ConstantsFruit.fruitDayMax);

		QQDC.getInstance().logClick(player, LogFieldType.tree);
		return ResponseMessage.getSuccMessage(map);
	}

	/**
	 * 树果实的加速
	 * 
	 * @param session
	 * @param id
	 * @return
	 */
	public ResponseMessage treeFast(Session session, int id) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);
		PlayerFruit fruit = fruitMap.get(id);
		if (fruit == null || fruit.getSeason() >= 5) {
			return null;
		}
		if (player.getGoldAll() < ConstantsFruit.fruitFastGold) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.gold"));
		}
		player.alterGoldAll(-ConstantsFruit.fruitFastGold);
		player.commitSync();
		// 记录果实加速次数  结束：11-13
//		player.getDataInfo().getEveryDay().intDataAlter(ConstantsDayIntKey.tft, 1);
//		player.getDataInfo().commitSync();

		Context.getOperationServer().fruitMature(session.getUid(), fruit, true);

		LogServer.costEventLog(session.getUid(), ConstantsFruit.fruitFastGold, ConstantsCost.treeFast);
		LogServer.recordLog(player, ConstantsLog.activity, 90201, ConstantsFruit.fruitFastGold, 1);

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("gold", player.getGold());
		map.put("goldBing", player.getGoldBing());
		map.put("fruit", fruit.toVO());
		return ResponseMessage.getSuccMessage(map);
	}

	public ResponseMessage treeFastAll(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);
		Iterator<PlayerFruit> it = fruitMap.values().iterator();
		List<FruitVO> fruitsList = new ArrayList<FruitVO>();
		int costGold = 0;
		boolean needGold = false;
		int upNum = 0;
		while (it.hasNext()) {
			PlayerFruit e = (PlayerFruit) it.next();
			if (e == null) {
				continue;
			}
			if (e.getSeason() < ConstantsFruit.fruitSeasonMax) {
				needGold = true;
				if (player.getGoldAll() < costGold + ConstantsFruit.fruitFastGold) {
					break;
				}
				costGold += ConstantsFruit.fruitFastGold;
				Context.getOperationServer().fruitMature(session.getUid(), e, true);
				upNum++;
				fruitsList.add(e.toVO());
			}
		}
		if (costGold > 0) {
			player.alterGoldAll(-costGold);
			player.commitSync();

			LogServer.costEventLog(session.getUid(), costGold, ConstantsCost.treeFast);
			LogServer.recordLog(player, ConstantsLog.activity, 90201, costGold, upNum);
			// 记录果实加速次数  结束：11-13
//			player.getDataInfo().getEveryDay().intDataAlter(ConstantsDayIntKey.tft, upNum);
//			player.getDataInfo().commitSync();
		} else if (needGold) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.gold"));
		}

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("gold", player.getGold());
		map.put("goldBing", player.getGoldBing());
		map.put("costGold", costGold);
		map.put("fruits", fruitsList);
		return ResponseMessage.getSuccMessage(map);
	}

	/**
	 * 加速到最高级
	 * 
	 * @param session
	 * @param id
	 * @return
	 */
	public ResponseMessage treeFastMax(Session session, int id) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);
		PlayerFruit fruit = fruitMap.get(id);
		if (fruit == null || fruit.getSeason() >= 5 || fruit.getSeason() == 0) {
			return null;
		}
		int costGold = ConstantsFruit.fruitFastMaxGold[fruit.getType()];

		if (costGold <= 0 || player.getGoldAll() < costGold) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.gold"));
		}
		player.alterGoldAll(-costGold);
		player.commitSync();
		Context.getOperationServer().fruitMature(session.getUid(), fruit, true, 5);
		// 记录果实加速次数  结束：11-13
//		player.getDataInfo().getEveryDay().intDataAlter(ConstantsDayIntKey.tft, 5);
//		player.getDataInfo().commitSync();
		
		LogServer.costEventLog(session.getUid(), costGold, ConstantsCost.treeFastMax);
		LogServer.recordLog(player, ConstantsLog.activity, 90201, costGold, 1);

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("gold", player.getGold());
		map.put("goldBing", player.getGoldBing());
		map.put("fruit", fruit.toVO());
		return ResponseMessage.getSuccMessage(map);
	}

	/**
	 * 树果实的收获
	 * 
	 * @param session
	 * @param id
	 * @return
	 */
	public ResponseMessage treeGain(Session session, int id) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		int fruitDayNum = player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.fruit);
		int fruitBuyNum = player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.fruitBuy);
		if (fruitDayNum >= ConstantsFruit.fruitDayMax + fruitBuyNum) {
			return null;
		}
		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);

		PlayerFruit fruit = fruitMap.get(id);
		if (fruit == null || fruit.getLevel() == 0) {
			return null;
		}

		TreeFruit fruitGain = TreeFruit.getOne(fruit.getType(), fruit.getLevel());
		int levelIndex = fruit.getLevel() - 1;

		fruitDayNum++;
		int gotAsset = 0;
		GoodsMode awardMode = null;
		if (fruitGain.getType() == 1) {
			gotAsset = ConstantsFruit.fruitAwardAsset[fruitGain.getLevel()] * player.getLevel();
			player.alterAsset(gotAsset);
		} else {
			if (!player.getPlayerBoxs().checkBlack()) {
				return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.player.boxmin", 1));
			}
			int[] awardIds;
			if (fruitGain.getType() == 2) {
				awardIds = ConstantsFruit.fruitAwardBaoshi[levelIndex];
			} else {
				int cplayerLevel = 0;
				if (player.getLevel() >= 81) {
					cplayerLevel = 3;
				} else if (player.getLevel() >= 61) {
					cplayerLevel = 2;
				} else if (player.getLevel() >= 41) {
					cplayerLevel = 1;
				}
				awardIds = ConstantsFruit.fruitAswarEquip[levelIndex][cplayerLevel];
			}
			if (awardIds == null || awardIds.length == 0) {
				return null;
			}
			int gotGoodsId = awardIds[NumberProcesser.mtRand(awardIds.length) - 1];
			awardMode = Context.getGoodsServer().getModeById(gotGoodsId);
			if (awardMode == null) {
				return null;
			}
			int bind = fruit.isFast() ? 0 : 1;
			Context.getGoodsServer().giveGoodsBing(session.getUid(), gotGoodsId, 1, bind);

			if (awardMode.getColor() >= 3) {
				ChatMain.systemMessage(LanguageLib.get("operation.got.chat", player.getPlayerName(),
						LangUtil.makeHtml(fruitGain.getLevel() - 1, fruitGain.getName()), LangUtil.makeHtml(awardMode.getColor(), awardMode.getName())));
			}
		}

		PlayerFruit fruitNew = new PlayerFruit(id, TimeProcesser.getUnixTime());
		fruitMap.put(id, fruitNew);// 覆盖数据
		//增加暑期活动任务完成标志
		//int hTask = player.getDataInfo().intDataGet(ConstantsIntKey.hTask);
		//player.getDataInfo().intDataSet(ConstantsIntKey.hTask, hTask | 1);
		
		player.getDataInfo().getEveryDay().intDataSet(ConstantsDayIntKey.fruit, fruitDayNum);
		//加入到每日奖励
		player.getDataInfo().getEveryDay().finishDailyItem(ConstantsDailyItem.takeFruitItem);
		player.getDataInfo().commitSync();

		String gotGoodsName = awardMode == null ? null : awardMode.getName();

		LogServer.recordLog(player, ConstantsLog.activity, 90202, fruitGain.getName(), id, gotAsset, gotGoodsName);

		String content = LanguageLib.get(gotAsset > 0 ? "operation.grow.sucasset" : "operation.grow.suc",
				LangUtil.makeHtml(fruitGain.getLevel() - 1, fruitGain.getName()),
				gotAsset > 0 ? gotAsset : LangUtil.makeHtml(awardMode.getColor(), gotGoodsName));
		Context.getMessageServer().recordEvent(session.getUid(), LanguageLib.get("operation.grow.title", fruit.getSeason()), content, Constants.eventTypeFruit);

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("gotAsset", gotAsset);
		map.put("asset", player.getAsset());
		map.put("gotGoodsName", gotGoodsName);
		if (awardMode != null) {
			map.put("awardColor", awardMode.getColor());
		}
		map.put("fruit", fruitNew.toVO());
		map.put("fruitDayNum", fruitDayNum);
		return ResponseMessage.getSuccMessage(map);
	}

	/**
	 * 树果实的丢弃
	 * 
	 * @param session
	 * @param id
	 * @return
	 */
	public ResponseMessage treeRemove(Session session, int id) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);
		PlayerFruit fruit = fruitMap.get(id);
		if (fruit == null) {
			return null;
		}
		TreeFruit fruitRemoved = TreeFruit.getOne(fruit.getType(), fruit.getLevel());

		fruit = new PlayerFruit(id, TimeProcesser.getUnixTime());
		fruitMap.put(id, fruit);// 覆盖数据
		player.getDataInfo().commitSync();

		LogServer.recordLog(player, ConstantsLog.activity, 90203, fruitRemoved.getName(), id);

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("fruit", fruit.toVO());
		return ResponseMessage.getSuccMessage(map);
	}

	/**
	 * 购买果子条数
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage treeQueueBuy(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		Map<Integer, PlayerFruit> fruitMap = player.getDataInfo().getFruitMap(true);
		int currentSize = fruitMap.size();
		if (currentSize >= 5) {
			return null;
		}
		int costGold = currentSize == 3 ? 80 : 100;
		if (player.getGoldAll() < costGold) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.gold"));
		}
		player.alterGoldAll(-costGold);
		int id = currentSize + 1;
		PlayerFruit fruit = new PlayerFruit(id, TimeProcesser.getUnixTime());
		fruitMap.put(id, fruit);// 覆盖数据
		player.commitSync();
		player.getDataInfo().commitSync();

		LogServer.costEventLog(session.getUid(), costGold, ConstantsCost.treeQueue);
		LogServer.recordLog(player, ConstantsLog.activity, 90204, costGold, fruitMap.size());

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("fruit", fruit.toVO());
		map.put("gold", player.getGold());
		map.put("goldBing", player.getGoldBing());
		return ResponseMessage.getSuccMessage(map);
	}

	/**
	 * 额外购买次数
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage treeFruitBuy(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv30Tree) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv30Tree));
		}
		int fruitBuyNum = player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.fruitBuy);
		if (fruitBuyNum >= 8) {
			return null;
		}
		int costGold = ConstantsFruit.fruitBuyGold[fruitBuyNum];
		if (costGold <= 0) {
			return null;
		}
		if (player.getGoldAll() < costGold) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.gold"));
		}
		player.alterGoldAll(-costGold);
		fruitBuyNum++;
		player.getDataInfo().getEveryDay().intDataSet(ConstantsDayIntKey.fruitBuy, fruitBuyNum);
		player.getDataInfo().commitSync();
		player.commitSync();

		LogServer.costEventLog(session.getUid(), costGold, ConstantsCost.treeFruit);
		LogServer.recordLog(player, ConstantsLog.activity, 90205, costGold, fruitBuyNum);

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("gold", player.getGold());
		map.put("goldBing", player.getGoldBing());
		map.put("fruitDayMax", fruitBuyNum + ConstantsFruit.fruitDayMax);
		return ResponseMessage.getSuccMessage(map);
	}
	
	/**
	 * 神龙显示
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage dragonShow(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv50Dragon) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv50Dragon));
		}
		int freeUsed = player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.drf);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("pn", player.getDataInfo().intDataGet(ConstantsIntKey.pn));
		map.put("f", ConstantsModel.dragonDrawFreeMax - freeUsed);
		map.put("lv", player.getDataInfo().intDataGet(ConstantsIntKey.dlv));
		return ResponseMessage.getSuccMessage(map);
	}
	
	/**
	 * 画龙
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage dragonDraw(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv50Dragon) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv50Dragon));
		}
		
		int lv = player.getDataInfo().intDataGet(ConstantsIntKey.dlv);
		if (lv > 0) {
			return null;
		}
		int freeUsed = player.getDataInfo().getEveryDay().intDataGet(ConstantsDayIntKey.drf);
		boolean isFree = ConstantsModel.dragonDrawFreeMax - freeUsed > 0;
		int pn = player.getDataInfo().intDataGet(ConstantsIntKey.pn);
		if (!isFree && pn <= 0) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("operation.dragon.notenough"));
		}
		int dragonType = NumberProcesser.rateIndex(ConstantsModel.dragonDrawRate);
		lv = dragonType * 100 + 10 + 1;//百位为类型，十位为等级， 个位为上次是否升级成功
		player.getDataInfo().intDataSet(ConstantsIntKey.dlv, lv);
		
		if (isFree) {
			freeUsed++;
			player.getDataInfo().getEveryDay().intDataSet(ConstantsDayIntKey.drf, freeUsed);
		} else {
			pn--;
			player.getDataInfo().intDataSet(ConstantsIntKey.pn, pn);
		}
		player.getDataInfo().commitSync();
		LogServer.recordLog(player, ConstantsLog.activity, 90501, dragonType, isFree, pn);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("pn", pn);
		map.put("f", ConstantsModel.dragonDrawFreeMax - freeUsed);
		map.put("lv", lv);
		return ResponseMessage.getSuccMessage(map);
	}
	
	/**
	 * 神龙点睛
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage dragonEyes(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv50Dragon) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv50Dragon));
		}
		int lv = player.getDataInfo().intDataGet(ConstantsIntKey.dlv);
		int step = lv % 100 / 10;
		boolean preSuc = (lv % 100) % 10 == 1;//上次是否成功
		if (lv <= 0 || step >= 5 || !preSuc) {
			return null;
		}
		if (player.getGoldAll() < ConstantsModel.dragonEyesGold[step - 1]) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.gold"));
		}
		boolean suc = NumberProcesser.isWinning(ConstantsModel.dragonEyesRate[step - 1]);
		
		lv += suc ? 10 : -1;//百位为类型，十位为等级， 个位为上次是否升级成功
		player.getDataInfo().intDataSet(ConstantsIntKey.dlv, lv);
		player.getDataInfo().commitSync();
		
		player.alterGoldAll(-ConstantsModel.dragonEyesGold[step - 1]);
		LogServer.costEventLog(session.getUid(), ConstantsModel.dragonEyesGold[step - 1], ConstantsCost.dragonEyes);
		player.commitSync();
		
		LogServer.recordLog(player, ConstantsLog.activity, 90502, ConstantsModel.dragonEyesGold[step - 1], suc, lv);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("gold", player.getGold());
		map.put("goldBing", player.getGoldBing());
		map.put("lv", lv);
		return ResponseMessage.getSuccMessage(map);
	}
	/**
	 * 领取神龙点睛奖励
	 * 
	 * @param session
	 * @return
	 */
	public ResponseMessage dragonAward(Session session) {
		Player player = Context.getPlayerServer().getByPlayerId(session.getUid());
		if (player.getLevel() < ConstantsLevel.lv50Dragon) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.err.level", ConstantsLevel.lv50Dragon));
		}
		int lv = player.getDataInfo().intDataGet(ConstantsIntKey.dlv);
		
		if (lv <= 0) {
			return null;
		}
		DragonAward award = DragonAward.get(lv);
		if (award == null) {
			return null;
		}
		int awardNum = award.getAwardArr().length;
		int needSize = 0;
		for (int i =0; i < awardNum; i++) {
			GoodsMode goodsMode = Context.getGoodsServer().getModeById(award.getAwardArr()[i]);
			if (goodsMode != null) {
				needSize += NumberProcesser.ceil(award.getNumArr()[i], goodsMode.getMaxStack());
			}
		}
		if (!player.getPlayerBoxs().checkBlack(needSize)) {
			return ResponseMessage.ticpErrMsg(LanguageLib.get("comm.player.boxmin", needSize));
		}
		
		StringBuilder logSB = new StringBuilder();
		int goodsId = 0;
		for (int i =0; i < awardNum; i++) {
			goodsId = award.getAwardArr()[i];
			GoodsMode goodsMode = Context.getGoodsServer().getModeById(goodsId);
			if (goodsMode != null) {
				Context.getGoodsServer().giveGoodsBing(player.getPlayerId(), goodsId, award.getNumArr()[i], award.getBind());
				logSB.append("|" + goodsMode.getName() + ":" + award.getNumArr()[i]);
			}else{
				LogUtil.getMain().error("dragonAward err playerId: " + player.getPlayerId() + "goodsId "+ goodsId);
			}
		}
		
		player.getDataInfo().intDataSet(ConstantsIntKey.dlv, 0);
		player.getDataInfo().commitSync();
		
		LogServer.recordLog(player, ConstantsLog.activity, 90503, lv, award.getId(), logSB.toString());
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("lv", player.getDataInfo().intDataGet(ConstantsIntKey.dlv));
		return ResponseMessage.getSuccMessage(map);
	}
}
